clear all; close all; clc;
M = 30; N = 1e6;

x_u = 10+(22-10)*rand(1, N);
%g_u = randn(1,1);


 hist(x_u, 30);
 break
inte = sum(h) * (x(2) - x(1)); p = h / inte;
figure(1); plot(x, p, 'r', 'LineWidth', 5);
hold on; bar(x, p); hold off
xlabel('X'); ylabel('P(X)');
break;

x_n = (x_n - M/2) / sqrt(M/12);
[h, x] = hist(x_n, 30);
inte = sum(h) * (x(2) - x(1)); p = h / inte;
figure(2); plot(x, p, 'r', 'LineWidth', 5);
hold on; bar(x, p); hold off
xlabel('X'); ylabel('P(X)');
x_n = 3*x_n + 9;
[h, x] = hist(x_n, 30);
inte = sum(h) * (x(2) - x(1)); p = h / inte;
figure(3); plot(x, p, 'r', 'LineWidth', 5);
hold on; bar(x, p); hold off
xlabel('X'); ylabel('P(X)');
